<div class="m-bg">
<h1>MySQL DATE() 函数</h1>
<h2>定义和用法</h2> <p>DATE() 函数提取日期或日期/时间表达式的日期部分。</p> <h3><b>语法</b></h3> <div class="code notranslate"><pre><code class="language-sql"><div> DATE(date)</div></code></pre></div> <p>date 参数是合法的日期表达式。</p> <h3>实例</h3> <p>假设我们有如下的 "Orders" 表：</p> <table class="reference notranslate">
<tr>
<th align="left">OrderId</th> <th align="left">ProductName</th> <th align="left">OrderDate</th> </tr>
<tr>
<td>1</td> <td>Jarlsberg Cheese</td> <td>2008-11-11 13:23:44.657</td> </tr>
</table>
<p>下面是 SELECT 语句：</p> <div class="code notranslate"><pre><code class="language-sql"><div> SELECT ProductName, DATE(OrderDate) AS OrderDate<br/> FROM Orders<br/> WHERE OrderId=1</div></code></pre></div> <p>结果如下所示：</p> <table class="reference notranslate">
<tr>
<th align="left">ProductName</th> <th align="left">OrderDate</th> </tr>
<tr>
<td>Jarlsberg Cheese</td> <td>2008-11-11</td> </tr>
</table>
<div class="text-center padding-10 margin-t-5">
</div>
</div>